home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / mach / machine.h < prev    next >
Text File  |  1995-02-14  |  9KB  |  301 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1989 Carnegie-Mellon University
  4.  * Copyright (c) 1988 Carnegie-Mellon University
  5.  * Copyright (c) 1987 Carnegie-Mellon University
  6.  * All rights reserved.  The CMU software License Agreement specifies
  7.  * the terms and conditions for use and redistribution.
  8.  */
  9. /*
  10.  * HISTORY
  11.  * $Log:    machine.h,v $
  12.  *  2 July 1992    Mac Gillon at NeXT
  13.  *    Changed HPPA subtypes to follow our practice. 
  14.  *
  15.  * 11 September 1992 David E. Bohman at NeXT
  16.  *    Added CPU_SUBTYPE_486SX to the i386 family.
  17.  *
  18.  * 16 July 1992 David E. Bohman at NeXT
  19.  *    Added CPU_SUBTYPE_586 to the i386 family.
  20.  *
  21.  * 17-Dec-91  Peter King (king) at NeXT
  22.  *    Added support for the XXX_ALL subtypes.  These are used to
  23.  *    tag object files that can run on any implementation of a
  24.  *    particular family.
  25.  *
  26.  *  1-Mar-90  John Seamons (jks) at NeXT
  27.  *    Redefined cpu_type and cpu_subtype definitions to indicate processor
  28.  *    architecture instead of product types for the MC680x0.
  29.  *
  30.  * Revision 2.15  89/10/11  14:39:56  dlb
  31.  *     Removed should_exit - replaced by action thread.
  32.  *     [89/01/25            dlb]
  33.  * 
  34.  * Revision 2.14  89/07/14  17:21:39  rvb
  35.  *     Added CPU types and subtypes for MC68030, MC68040, MC88000,
  36.  *     HPPA, ARM and Sun4-SPARC.
  37.  *     [89/07/13            mrt]
  38.  * 
  39.  * Revision 2.12  89/05/30  10:38:58  rvb
  40.  *     Add R2000 machine types.
  41.  *     [89/05/30  08:28:53  rvb]
  42.  * 
  43.  * Revision 2.11  89/04/18  16:43:32  mwyoung
  44.  *     Use <machine/vm_types.h> rather than <vm/vm_param.h> to get
  45.  *     VM types.  Remove old history... none of it was insightful.
  46.  * 
  47.  *     The variable declarations should be moved elsewhere.
  48.  *     [89/01/24            mwyoung]
  49.  * 
  50.  */
  51. /*
  52.  *    Machine independent machine abstraction.
  53.  *    Copyright (C) 1986, Avadis Tevanian, Jr.
  54.  */
  55.  
  56. #ifndef    _MACH_MACHINE_H_
  57. #define _MACH_MACHINE_H_
  58.  
  59. #import <mach/machine/vm_types.h>
  60. #import <mach/boolean.h>
  61.  
  62. /*
  63.  *    For each host, there is a maximum possible number of
  64.  *    cpus that may be available in the system.  This is the
  65.  *    compile-time constant NCPUS, which is defined in cpus.h.
  66.  *
  67.  *    In addition, there is a machine_slot specifier for each
  68.  *    possible cpu in the system.
  69.  */
  70.  
  71. struct machine_info {
  72.     int        major_version;    /* kernel major version id */
  73.     int        minor_version;    /* kernel minor version id */
  74.     int        max_cpus;    /* max number of cpus compiled */
  75.     int        avail_cpus;    /* number actually available */
  76.     vm_size_t    memory_size;    /* size of memory in bytes */
  77. };
  78.  
  79. typedef struct machine_info    *machine_info_t;
  80. typedef struct machine_info    machine_info_data_t;    /* bogus */
  81.  
  82. typedef int    cpu_type_t;
  83. typedef int    cpu_subtype_t;
  84.  
  85. #define CPU_STATE_MAX        3
  86.  
  87. #define CPU_STATE_USER        0
  88. #define CPU_STATE_SYSTEM    1
  89. #define CPU_STATE_IDLE        2
  90.  
  91. struct machine_slot {
  92.     boolean_t    is_cpu;        /* is there a cpu in this slot? */
  93.     cpu_type_t    cpu_type;    /* type of cpu */
  94.     cpu_subtype_t    cpu_subtype;    /* subtype of cpu */
  95.     volatile boolean_t running;    /* is cpu running */
  96.     long        cpu_ticks[CPU_STATE_MAX];
  97.     int        clock_freq;    /* clock interrupt frequency */
  98. };
  99.  
  100. typedef struct machine_slot    *machine_slot_t;
  101. typedef struct machine_slot    machine_slot_data_t;    /* bogus */
  102.  
  103. #ifdef    KERNEL
  104. extern struct machine_info    machine_info;
  105. extern struct machine_slot    machine_slot[];
  106.  
  107. extern vm_offset_t        interrupt_stack[];
  108. #endif    KERNEL
  109.  
  110. /*
  111.  *    Machine types known by all.
  112.  */
  113.  
  114. #define CPU_TYPE_ANY        ((cpu_type_t) -1)
  115.  
  116. #define CPU_TYPE_VAX        ((cpu_type_t) 1)
  117. #define CPU_TYPE_ROMP        ((cpu_type_t) 2)
  118. #define CPU_TYPE_NS32032    ((cpu_type_t) 4)
  119. #define CPU_TYPE_NS32332        ((cpu_type_t) 5)
  120. #define    CPU_TYPE_MC680x0    ((cpu_type_t) 6)
  121. #define CPU_TYPE_I386        ((cpu_type_t) 7)
  122. #define CPU_TYPE_MIPS        ((cpu_type_t) 8)
  123. #define CPU_TYPE_NS32532        ((cpu_type_t) 9)
  124. #define CPU_TYPE_HPPA           ((cpu_type_t) 11)
  125. #define CPU_TYPE_ARM        ((cpu_type_t) 12)
  126. #define CPU_TYPE_MC88000    ((cpu_type_t) 13)
  127. #define CPU_TYPE_SPARC        ((cpu_type_t) 14)
  128. #define CPU_TYPE_I860        ((cpu_type_t) 15) // big-endian
  129. #define    CPU_TYPE_I860_LITTLE    ((cpu_type_t) 16) // little-endian
  130. #define CPU_TYPE_RS6000        ((cpu_type_t) 17)
  131. #define CPU_TYPE_MC98000    ((cpu_type_t) 18)
  132.         
  133.  
  134. /*
  135.  *    Machine subtypes (these are defined here, instead of in a machine
  136.  *    dependent directory, so that any program can get all definitions
  137.  *    regardless of where is it compiled).
  138.  */
  139.  
  140. /*
  141.  *    Object files that are hand-crafted to run on any
  142.  *    implementation of an architecture are tagged with
  143.  *    CPU_SUBTYPE_MULTIPLE.  This functions essentially the same as
  144.  *    the "ALL" subtype of an architecture except that it allows us
  145.  *    to easily find object files that may need to be modified
  146.  *    whenever a new implementation of an architecture comes out.
  147.  *
  148.  *    It is the responsibility of the implementor to make sure the
  149.  *    software handles unsupported implementations elegantly.
  150.  */
  151. #define    CPU_SUBTYPE_MULTIPLE        ((cpu_subtype_t) -1)
  152. #define CPU_SUBTYPE_LITTLE_ENDIAN    ((cpu_subtype_t) 0)
  153. #define CPU_SUBTYPE_BIG_ENDIAN        ((cpu_subtype_t) 1)
  154.  
  155. /*
  156.  *    VAX subtypes (these do *not* necessary conform to the actual cpu
  157.  *    ID assigned by DEC available via the SID register).
  158.  */
  159.  
  160. #define    CPU_SUBTYPE_VAX_ALL    ((cpu_subtype_t) 0) 
  161. #define CPU_SUBTYPE_VAX780    ((cpu_subtype_t) 1)
  162. #define CPU_SUBTYPE_VAX785    ((cpu_subtype_t) 2)
  163. #define CPU_SUBTYPE_VAX750    ((cpu_subtype_t) 3)
  164. #define CPU_SUBTYPE_VAX730    ((cpu_subtype_t) 4)
  165. #define CPU_SUBTYPE_UVAXI    ((cpu_subtype_t) 5)
  166. #define CPU_SUBTYPE_UVAXII    ((cpu_subtype_t) 6)
  167. #define CPU_SUBTYPE_VAX8200    ((cpu_subtype_t) 7)
  168. #define CPU_SUBTYPE_VAX8500    ((cpu_subtype_t) 8)
  169. #define CPU_SUBTYPE_VAX8600    ((cpu_subtype_t) 9)
  170. #define CPU_SUBTYPE_VAX8650    ((cpu_subtype_t) 10)
  171. #define CPU_SUBTYPE_VAX8800    ((cpu_subtype_t) 11)
  172. #define CPU_SUBTYPE_UVAXIII    ((cpu_subtype_t) 12)
  173.  
  174. /*
  175.  *    ROMP subtypes.
  176.  */
  177.  
  178. #define    CPU_SUBTYPE_RT_ALL    ((cpu_subtype_t) 0)
  179. #define CPU_SUBTYPE_RT_PC    ((cpu_subtype_t) 1)
  180. #define CPU_SUBTYPE_RT_APC    ((cpu_subtype_t) 2)
  181. #define CPU_SUBTYPE_RT_135    ((cpu_subtype_t) 3)
  182.  
  183. /*
  184.  *    32032/32332/32532 subtypes.
  185.  */
  186.  
  187. #define    CPU_SUBTYPE_MMAX_ALL        ((cpu_subtype_t) 0)
  188. #define CPU_SUBTYPE_MMAX_DPC        ((cpu_subtype_t) 1)    /* 032 CPU */
  189. #define CPU_SUBTYPE_SQT            ((cpu_subtype_t) 2)
  190. #define CPU_SUBTYPE_MMAX_APC_FPU    ((cpu_subtype_t) 3)    /* 32081 FPU */
  191. #define CPU_SUBTYPE_MMAX_APC_FPA    ((cpu_subtype_t) 4)    /* Weitek FPA */
  192. #define CPU_SUBTYPE_MMAX_XPC        ((cpu_subtype_t) 5)    /* 532 CPU */
  193.  
  194. /*
  195.  *    I386 subtypes.
  196.  */
  197.  
  198. #define    CPU_SUBTYPE_I386_ALL    ((cpu_subtype_t) 3)
  199. #define CPU_SUBTYPE_386        ((cpu_subtype_t) 3)
  200. #define CPU_SUBTYPE_486        ((cpu_subtype_t) 4)
  201. #define CPU_SUBTYPE_486SX    ((cpu_subtype_t) 4 + 128)
  202. #define CPU_SUBTYPE_586        ((cpu_subtype_t) 5)
  203. #define CPU_SUBTYPE_586SX    ((cpu_subtype_t) 5 + 128)
  204.  
  205. /*
  206.  *    Mips subtypes.
  207.  */
  208.  
  209. #define    CPU_SUBTYPE_MIPS_ALL    ((cpu_subtype_t) 0)
  210. #define CPU_SUBTYPE_MIPS_R2300    ((cpu_subtype_t) 1)
  211. #define CPU_SUBTYPE_MIPS_R2600    ((cpu_subtype_t) 2)
  212. #define CPU_SUBTYPE_MIPS_R2800    ((cpu_subtype_t) 3)
  213. #define CPU_SUBTYPE_MIPS_R2000a    ((cpu_subtype_t) 4)
  214.  
  215. /*
  216.  *     680x0 subtypes
  217.  *
  218.  * The subtype definitions here are unusual for historical reasons.
  219.  * NeXT used to consider 68030 code as generic 68000 code.  For
  220.  * backwards compatability:
  221.  * 
  222.  *    CPU_SUBTYPE_MC68030 symbol has been preserved for source code
  223.  *    compatability.
  224.  *
  225.  *    CPU_SUBTYPE_MC680x0_ALL has been defined to be the same
  226.  *    subtype as CPU_SUBTYPE_MC68030 for binary comatability.
  227.  *
  228.  *    CPU_SUBTYPE_MC68030_ONLY has been added to allow new object
  229.  *    files to be tagged as containing 68030-specific instructions.
  230.  */
  231.  
  232. #define    CPU_SUBTYPE_MC680x0_ALL        ((cpu_subtype_t) 1)
  233. #define CPU_SUBTYPE_MC68030        ((cpu_subtype_t) 1) /* compat */
  234. #define CPU_SUBTYPE_MC68040        ((cpu_subtype_t) 2) 
  235. #define    CPU_SUBTYPE_MC68030_ONLY    ((cpu_subtype_t) 3)
  236.  
  237. /*
  238.  *    HPPA subtypes for Hewlett-Packard HP-PA family of
  239.  *    risc processors. Port by NeXT to 700 series. 
  240.  */
  241.  
  242. #define    CPU_SUBTYPE_HPPA_ALL        ((cpu_subtype_t) 0)
  243. #define CPU_SUBTYPE_HPPA_7100        ((cpu_subtype_t) 0) /* compat */
  244. #define CPU_SUBTYPE_HPPA_7100LC        ((cpu_subtype_t) 1)
  245.  
  246. /* 
  247.  *     Acorn subtypes - Acorn Risc Machine port done by
  248.  *        Olivetti System Software Laboratory
  249.  */
  250.  
  251. #define    CPU_SUBTYPE_ARM_ALL        ((cpu_subtype_t) 0)
  252. #define CPU_SUBTYPE_ARM_A500_ARCH    ((cpu_subtype_t) 1)
  253. #define CPU_SUBTYPE_ARM_A500        ((cpu_subtype_t) 2)
  254. #define CPU_SUBTYPE_ARM_A440        ((cpu_subtype_t) 3)
  255. #define CPU_SUBTYPE_ARM_M4        ((cpu_subtype_t) 4)
  256. #define CPU_SUBTYPE_ARM_A680        ((cpu_subtype_t) 5)
  257.  
  258. /*
  259.  *    MC88000 subtypes
  260.  */
  261. #define    CPU_SUBTYPE_MC88000_ALL    ((cpu_subtype_t) 0)
  262. #define CPU_SUBTYPE_MMAX_JPC    ((cpu_subtype_t) 1)
  263. #define CPU_SUBTYPE_MC88100    ((cpu_subtype_t) 1)
  264. #define CPU_SUBTYPE_MC88110    ((cpu_subtype_t) 2)
  265.  
  266. /*
  267.  *    MC98000 (PowerPC) subtypes
  268.  */
  269. #define    CPU_SUBTYPE_MC98000_ALL    ((cpu_subtype_t) 0)
  270. #define CPU_SUBTYPE_MC98601    ((cpu_subtype_t) 1)
  271.  
  272. /*
  273.  *    I860 subtypes
  274.  */
  275. #define CPU_SUBTYPE_I860_ALL    ((cpu_subtype_t) 0)
  276. #define CPU_SUBTYPE_I860_860    ((cpu_subtype_t) 1)
  277.  
  278. /*
  279.  *     I860 subtypes for NeXT-internal backwards compatability.
  280.  *    These constants will be going away.  DO NOT USE THEM!!!
  281.  */
  282.  
  283. /*
  284.  *    I860_LITTLE subtypes
  285.  */
  286. #define    CPU_SUBTYPE_I860_LITTLE_ALL    ((cpu_subtype_t) 0)
  287. #define    CPU_SUBTYPE_I860_LITTLE    ((cpu_subtype_t) 1)
  288.  
  289. /*
  290.  *    RS6000 subtypes
  291.  */
  292. #define    CPU_SUBTYPE_RS6000_ALL    ((cpu_subtype_t) 0)
  293. #define CPU_SUBTYPE_RS6000    ((cpu_subtype_t) 1)
  294.  
  295. /*
  296.  *    SPARC subtypes
  297.  */
  298. #define    CPU_SUBTYPE_SPARC_ALL        ((cpu_subtype_t) 0)
  299.  
  300. #endif    _MACH_MACHINE_H_
  301.